package com.miguo.utils;

import com.miguo.framework.request.JsonData;

import java.util.ArrayList;
import java.util.HashMap;


public class SignRecorUtil {
	public static ArrayList<HashMap<String, String>> getSignRecors(
			JsonData score_log) {
		ArrayList<HashMap<String, String>> mList = new ArrayList<HashMap<String, String>>();
		for (int i = 0; i < score_log.length(); i++) {
			JsonData item = score_log.optJson(i);
			HashMap<String, String> map = new HashMap<String, String>();

			map.put("date", item.optString("add_time"));
			String score = item.optString("score");
			if (!score.contains("-")) {
				score = "+" + score;
			}
			map.put("score", score);
			String action = changeAction(item.optString("action"));
			map.put("action", action);
			mList.add(map);
		}

		return mList;
	}

	private static String changeAction(String action) {
		if (action.equals("register")) {
			return "注册";
		}
		if (action.equals("login")) {
			return "登录";
		}
		if (action.equals("sign")) {
			return "签到";
		}
		if (action.equals("union_visit")) {
			return "邀请访问";
		}
		if (action.equals("union_reg")) {
			return "邀请注册";
		}
		if (action.equals("system_send")) {
			return "系统赠送";
		}
		if (action.equals("userinfo")) {
			return "完善个人信息";
		}
		if (action.equals("luckaward")) {
			return "抽奖";
		}
		if (action.equals("award")) {
			return "大转盘抽奖";
		}
		if (action.equals("gift")) {
			return "礼品兑换";
		}
		if (action.equals("emailrequired")) {
			return "邮箱验证";
		}
		if (action.equals("awardrequest")) {
			return "大转盘抽奖赠送";
		}
		if (action.equals("weixin")) {
			return "微信绑定";
		}
		return "米果赠送";
	}

}
